package com.jmoto.android.test.helpers;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Canvas;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;

//Other Users overlays
public class ShowAllUsers extends ItemizedOverlay<MapOverlayItem> {

    private List<MapOverlayItem> locations = new ArrayList<MapOverlayItem>();
    private Drawable marker;

    public ShowAllUsers(Drawable marker, List<MapOverlayItem> overlayItems) {
        super(marker);

        this.marker = marker;

        // populate items
        for (MapOverlayItem overlayItem : overlayItems) {
            locations.add(overlayItem);
            populate();
        }
    }

    // a shadow of the marker
    @Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
        super.draw(canvas, mapView, shadow);
        boundCenterBottom(marker);
    }

    @Override
    protected MapOverlayItem createItem(int i) {
        return locations.get(i);
    }

    @Override
    public int size() {
        return locations.size();
    }

    // tab on marker
    @Override
    protected boolean onTap(int i) {

        MapOverlayItem item = (MapOverlayItem) getItem(i);

        // set data
        //mapPopUp.setData(item.getUserName(), item.getUserFullName(), item.getUserStatus());

        // show popup
        //mapPopUp.show();

        return true;
    }
}
